home *** CD-ROM | disk | FTP | other *** search
- Path: darkstar.UCSC.EDU!kama!jono
- From: jono@cse.ucsc.edu (Jonathan Gibbs)
- Newsgroups: comp.lang.c++
- Subject: Re: newing char**
- Date: 12 Feb 1996 04:43:49 GMT
- Organization: UC Santa Cruz CIS/CE
- Message-ID: <4fmgi5$jvv@darkstar.UCSC.EDU>
- References: <4fggal$4pf@darkstar.UCSC.EDU>
- NNTP-Posting-Host: kama.cse.ucsc.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Thanks for the replies. Unfortunatly I made a few typos in the post.
- The solution was change
- name = new (char*)[num];
- to
- name = new char*[num];
-
- Does anyone know if the () are legal, though?
-
- Jonathan Gibbs (jono@cse.ucsc.edu) wrote:
- : If I have the following declaration:
-
- : char **name;
-
- : The following line compiles fine with g++, but I get the following
- : error on SGI's CC. Which is right?
-
- : int num;
-
- of course, I set num in here.
-
- : name = new (char*)[num];
- : for (int i=0; i < num; i++) {
- : name = new char[25];
-
- oops, forgot to type the [i] after name.
-
- : }
-
- : SGI Error:
- : "segment.c++", line 43: error(3611): a value of type "char *" cannot be
- : assigned to an entity of type "char **"
- : _child_name = new (char*)[_num_children];
-
-
-
-
- : --
- : "The human mind is a dangerous plaything, boys. When it's used for evil,
- : watch out! But when it's used for good, then things are much nicer."
- : -- The Tick
- : <Home Page: http://www.cse.ucsc.edu/~jono>
-
- --
- "The human mind is a dangerous plaything, boys. When it's used for evil,
- watch out! But when it's used for good, then things are much nicer."
- -- The Tick
- <Home Page: http://www.cse.ucsc.edu/~jono>
-